import java.util.Scanner;

public class demo04 {
    //缩位求和
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String str=sc.nextLine();
        int sum=0;
        for (int i = 0; i < str.length(); i++) {
            sum+=str.charAt(i)-'0';
            if(sum>9){
                sum=sum%10+sum/10;
            }
        }
        System.out.println(sum);
    }
}
